<template>
  <div class="dialog-form">
    <el-form ref="logoffRef" :model="form" :rules="rules" label-width="100px">
      <el-form-item label="来源渠道：">{{ form.channelName }}</el-form-item>
      <el-form-item label="用户编号：">{{ form.platformUserId }}</el-form-item>
      <el-form-item label="电子卡号：">{{ form.cardNo }}</el-form-item>
      <el-form-item label="手机号码：">{{ form.mobile }}</el-form-item>
      <el-form-item label="退款金额：">{{ formatAmount(form.amount) }}元</el-form-item>
      <!-- <el-form-item label="销户审核状态：">
        <dict-tag :options="statusList" :value="form.auditStatus" />
      </el-form-item> -->
      <el-form-item label="审核备注：" prop="auditMsg">
        <el-input v-model="form.auditMsg" type="textarea" :rows="4" placeholder="请输入审核备注，最多100个字" :maxlength="100" show-word-limit />
      </el-form-item>
    </el-form>
    <div class="dialog-footer">
      <el-button @click="onConfirm(3)">驳回</el-button>
      <el-button type="primary" @click="onConfirm(2)">通过</el-button>
    </div>
  </div>
</template>

<script setup>
import { cancelRecordApproval } from "@/api/order/logoffList"
import { deepClone } from '@/utils/index'

const emits = defineEmits(['confirm'])
const props = defineProps(['statusList'])

const { proxy } = getCurrentInstance()

const logoffRef = ref()
const form = ref({
  id: null,
  auditMsg: null,
})
const rules = {
  auditMsg: [
    { required: true, message: "请输入审核备注", trigger: "blur" }
  ],
}

const pageInit = (row) => {
  form.value = deepClone(row)
}

const onConfirm = (type) => {
  logoffRef.value.validate(valid => {
    if (valid) {
      const params = {
        id: form.value.id,
        platformUserId: form.value.platformUserId,
        channelCode: form.value.channelCode,
        auditStatus: type,
        auditMsg: form.value.auditMsg
      }
      cancelRecordApproval(params).then(res => {
        proxy.$modal.msgSuccess("审核成功")
        emits('confirm')
      })
    }
  })
}

defineExpose({
  pageInit
})

</script>

<style lang="scss" scoped>

</style>